package com.kgc.server.controller;

import com.kgc.server.service.AddressService;
import com.kgc.server.util.ResponseMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class AddressController {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private AddressService addressService;

    @ResponseBody
    @RequestMapping("selectDefaultAddress")
    @CrossOrigin
    public ResponseMessage selectDefaultAddress(String userId){
        logger.info("AddressController selectDefaultAddress params: userId:"+userId);
        ResponseMessage responseMessage = addressService.selectDefaultAddress(userId);
        logger.info("AddressController selectDefaultAddress params: userId:"+userId+",responseMessage:"+responseMessage);
        return responseMessage;
    }
}
